<!DOCTYPE html>

<html>
<head>
<meta charset="UTF-8">
<link href="style.css" type="text/css" rel="stylesheet">
<title>VFIXUPIMMSD—Fix Up Special Scalar Float64 Value </title></head>
<body>
<h1>VFIXUPIMMSD—Fix Up Special Scalar Float64 Value</h1>
<table>
<tr>
<th>Opcode/Instruction</th>
<th>Op /En</th>
<th>64/32 bit Mode Support</th>
<th>CPUID Feature Flag</th>
<th>Description</th></tr>
<tr>
<td>
<p>EVEX.NDS.LIG.66.0F3A.W1 55 /r ib</p>
<p>VFIXUPIMMSD xmm1 {k1}{z}, xmm2, xmm3/m64{sae}, imm8</p></td>
<td>T1S</td>
<td>V/V</td>
<td>AVX512F</td>
<td>Fix up a float64 number in the low quadword element of xmm2 using scalar int32 table in xmm3/m64 and store the result in xmm1.</td></tr></table>
<h3>Instruction Operand Encoding</h3>
<table>
<tr>
<td>Op/En</td>
<td>Operand 1</td>
<td>Operand 2</td>
<td>Operand 3</td>
<td>Operand 4</td></tr>
<tr>
<td>T1S</td>
<td>ModRM:reg (r, w)</td>
<td>EVEX.vvvv</td>
<td>ModRM:r/m (r)</td>
<td>Imm8</td></tr></table>
<p><strong>Description</strong></p>
<p>Perform a fix-up of the low quadword element encoded in double-precision floating-point format in the first source operand (the second operand) using a 32-bit, two-level look-up table specified in the low quadword element of the second source operand (the third operand) with exception reporting specifier imm8. The element that is fixed-up is selected by mask bit of 1 specified in the opmask k1. Mask bit of 0 in the opmask k1 or table response action of 0000b preserves the corresponding element of the first operand. The fixed-up element from the first source operand or the preserved element in the first operand becomes the low quadword element of the destination operand (the first operand). Bits 127:64 of the destination operand is copied from the corresponding bits of the first source operand. The destination and first source operands are XMM registers. The second source operand can be a XMM register or a 64- bit memory location.</p>
<p>The two-level look-up table perform a fix-up of each DP FP input data in the first source operand by decoding the input data encoding into 8 token types. A response table is defined for each token type that converts the input encoding in the first source operand with one of 16 response actions.</p>
<p>This instruction is specifically intended for use in fixing up the results of arithmetic calculations involving one source so that they match the spec, although it is generally useful for fixing up the results of multiple-instruction sequences to reflect special-number inputs. For example, consider rcp(0). Input 0 to rcp, and you should get INF according to the DX10 spec. However, evaluating rcp via Newton-Raphson, where x=approx(1/0), yields an incor-rect result. To deal with this, VFIXUPIMMPD can be used after the N-R reciprocal sequence to set the result to the correct value (i.e. INF when the input is 0).</p>
<p>If MXCSR.DAZ is not set, denormal input elements in the first source operand are considered as normal inputs and do not trigger any fixup nor fault reporting.</p>
<p>Imm8 is used to set the required flags reporting. It supports #ZE and #IE fault reporting (see details below).</p>
<p>MXCSR.DAZ is used and refer to zmm2 only (i.e. zmm1 is not considered as zero in case MXCSR.DAZ is set).</p>
<p>MXCSR mask bits are ignored and are treated as if all mask bits are set to masked response). If any of the imm8 bits is set and the condition met for fault reporting, MXCSR.IE or MXCSR.ZE might be updated.</p>
<p><strong>Operation</strong></p>
<p>enum TOKEN_TYPE</p>
<p>{</p>
<p>QNAN_TOKEN (cid:197) 0,</p>
<p>SNAN_TOKEN (cid:197) 1,</p>
<p>ZERO_VALUE_TOKEN (cid:197) 2,</p>
<p>POS_ONE_VALUE_TOKEN (cid:197) 3,</p>
<p>NEG_INF_TOKEN (cid:197) 4,</p>
<p>POS_INF_TOKEN (cid:197) 5,</p>
<p>NEG_VALUE_TOKEN (cid:197) 6,</p>
<p>POS_VALUE_TOKEN (cid:197) 7</p>
<p>}</p>
<p>FIXUPIMM_DP (dest[63:0], src1[63:0],tbl3[63:0], imm8 [7:0]){</p>
<p>tsrc[63:0] (cid:197) ((src1[62:52] = 0) AND (MXCSR.DAZ =1)) ? 0.0 : src1[63:0]</p>
<p>CASE(tsrc[63:0] of TOKEN_TYPE) {</p>
<p>QNAN_TOKEN: j (cid:197) 0;</p>
<p>SNAN_TOKEN: j (cid:197) 1;</p>
<p>ZERO_VALUE_TOKEN: j (cid:197) 2;</p>
<p>POS_ONE_VALUE_TOKEN: j (cid:197) 3;</p>
<p>NEG_INF_TOKEN: j (cid:197) 4;</p>
<p>POS_INF_TOKEN: j (cid:197) 5;</p>
<p>NEG_VALUE_TOKEN: j (cid:197) 6;</p>
<p>POS_VALUE_TOKEN: j (cid:197) 7;</p>
<p>}</p>
<p>; end source special CASE(tsrc…)</p>
<p>; The required response from src3 table is extracted</p>
<p>token_response[3:0] = tbl3[3+4*j:4*j];</p>
<p>CASE(token_response[3:0]) {</p>
<p>0000: dest[63:0] (cid:197) dest[63:0]</p>
<p>; preserve content of DEST</p>
<p>0001: dest[63:0] (cid:197) tsrc[63:0];</p>
<p>; pass through src1 normal input value, denormal as zero</p>
<p>0010: dest[63:0] (cid:197) QNaN(tsrc[63:0]);</p>
<p>0011: dest[63:0] (cid:197) QNAN_Indefinite;</p>
<p>0100:dest[63:0] (cid:197) -INF;</p>
<p>0101: dest[63:0] (cid:197) +INF;</p>
<p>0110: dest[63:0] (cid:197) tsrc.sign? –INF : +INF;</p>
<p>0111: dest[63:0] (cid:197) -0;</p>
<p>1000: dest[63:0] (cid:197) +0;</p>
<p>1001: dest[63:0] (cid:197) -1;</p>
<p>1010: dest[63:0] (cid:197) +1;</p>
<p>1011: dest[63:0] (cid:197) ½;</p>
<p>1100: dest[63:0] (cid:197) 90.0;</p>
<p>1101: dest[63:0] (cid:197) PI/2;</p>
<p>1110: dest[63:0] (cid:197) MAX_FLOAT;</p>
<p>1111: dest[63:0] (cid:197) -MAX_FLOAT;</p>
<p>}</p>
<p>; end of token_response CASE</p>
<p>; The required fault reporting from imm8 is extracted</p>
<p>; TOKENs are mutually exclusive and TOKENs priority defines the order.</p>
<p>; Multiple faults related to a single token can occur simultaneously.</p>
<p>IF (tsrc[63:0] of TOKEN_TYPE: ZERO_VALUE_TOKEN) AND imm8[0] then set #ZE;</p>
<p>IF (tsrc[63:0] of TOKEN_TYPE: ZERO_VALUE_TOKEN) AND imm8[1] then set #IE;</p>
<p>IF (tsrc[63:0] of TOKEN_TYPE: ONE_VALUE_TOKEN) AND imm8[2] then set #ZE;</p>
<p>IF (tsrc[63:0] of TOKEN_TYPE: ONE_VALUE_TOKEN) AND imm8[3] then set #IE;</p>
<p>IF (tsrc[63:0] of TOKEN_TYPE: SNAN_TOKEN) AND imm8[4] then set #IE;</p>
<p>IF (tsrc[63:0] of TOKEN_TYPE: NEG_INF_TOKEN) AND imm8[5] then set #IE;</p>
<p>IF (tsrc[63:0] of TOKEN_TYPE: NEG_VALUE_TOKEN) AND imm8[6] then set #IE;</p>
<p>IF (tsrc[63:0] of TOKEN_TYPE: POS_INF_TOKEN) AND imm8[7] then set #IE;</p>
<p>; end fault reporting</p>
<p>return dest[63:0];</p>
<p>}</p>
<p>; end of FIXUPIMM_DP()</p>
<p><strong>VFIXUPIMMSD (EVEX encoded version)</strong></p>
<p>IF k1[0] OR *no writemask*</p>
<p>THEN DEST[63:0] (cid:197) FIXUPIMM_DP(DEST[63:0], SRC1[63:0], SRC2[63:0], imm8 [7:0])</p>
<p>ELSE</p>
<p>IF *merging-masking*</p>
<p>; merging-masking</p>
<p>THEN *DEST[63:0] remains unchanged*</p>
<p>ELSE  DEST[63:0] (cid:197) 0</p>
<p>; zeroing-masking</p>
<p>FI</p>
<p>FI;</p>
<p>DEST[127:64] (cid:197) SRC1[127:64]</p>
<p>DEST[MAX_VL-1:128] (cid:197) 0</p>
<p>Immediate Control Description:</p>
<svg width="594.089985" viewBox="103.440000 1071027.000010 396.059990 196.739985" height="295.1099775">
<text y="1071055.62953" x="327.18" style="font-size:12.001000pt" lengthAdjust="spacingAndGlyphs" textLength="6.672556">7</text>
<text y="1071055.62953" x="345.18" style="font-size:12.001000pt" lengthAdjust="spacingAndGlyphs" textLength="6.672556">6</text>
<text y="1071055.62953" x="363.18" style="font-size:12.001000pt" lengthAdjust="spacingAndGlyphs" textLength="6.672556">5</text>
<text y="1071055.62953" x="381.18" style="font-size:12.001000pt" lengthAdjust="spacingAndGlyphs" textLength="6.672556">4</text>
<text y="1071055.62953" x="399.18" style="font-size:12.001000pt" lengthAdjust="spacingAndGlyphs" textLength="6.672556">3</text>
<text y="1071055.62953" x="417.18" style="font-size:12.001000pt" lengthAdjust="spacingAndGlyphs" textLength="6.672556">2</text>
<text y="1071055.62953" x="435.18" style="font-size:12.001000pt" lengthAdjust="spacingAndGlyphs" textLength="6.672556">1</text>
<text y="1071055.62953" x="453.18" style="font-size:12.001000pt" lengthAdjust="spacingAndGlyphs" textLength="6.672556">0</text>
<rect y="1071043.5" x="337.68" style="fill:rgba(0,0,0,0);stroke:rgb(0,0,0);stroke-width:1pt;" height="18.0" width="17.22"></rect>
<rect y="1071142.5" x="139.68" style="fill:rgba(0,0,0,0);stroke:rgb(0,0,0);stroke-width:1pt;" height="17.22" width="108.0"></rect>
<rect y="1071070.5" x="139.68" style="fill:rgba(0,0,0,0);stroke:rgb(0,0,0);stroke-width:1pt;" height="18.0" width="108.0"></rect>
<rect y="1071106.5" x="139.68" style="fill:rgba(0,0,0,0);stroke:rgb(0,0,0);stroke-width:1pt;" height="18.0" width="108.0"></rect>
<rect y="1071124.5" x="139.68" style="fill:rgba(0,0,0,0);stroke:rgb(0,0,0);stroke-width:1pt;" height="18.0" width="108.0"></rect>
<rect y="1071088.5" x="139.68" style="fill:rgba(0,0,0,0);stroke:rgb(0,0,0);stroke-width:1pt;" height="18.0" width="108.0"></rect>
<rect y="1071159.72" x="139.68" style="fill:rgba(0,0,0,0);stroke:rgb(0,0,0);stroke-width:1pt;" height="18.0" width="108.0"></rect>
<rect y="1071177.72" x="139.68" style="fill:rgba(0,0,0,0);stroke:rgb(0,0,0);stroke-width:1pt;" height="18.0" width="108.0"></rect>
<rect y="1071195.72" x="139.68" style="fill:rgba(0,0,0,0);stroke:rgb(0,0,0);stroke-width:1pt;" height="18.0" width="108.0"></rect>
<path style="stroke:black" d="M319.680000,1071043.500000 L319.680000,1071061.500000 L337.680000,1071061.500000 L337.680000,1071043.500000 "></path>
<path style="stroke:black" d="M319.680000,1071043.500000 L319.680000,1071061.500000 L337.680000,1071061.500000 L337.680000,1071043.500000 "></path>
<path style="stroke:black" d="M354.900000,1071043.500000 L354.900000,1071061.500000 L372.900000,1071061.500000 L372.900000,1071043.500000 "></path>
<path style="stroke:black" d="M354.900000,1071043.500000 L354.900000,1071061.500000 L372.900000,1071061.500000 L372.900000,1071043.500000 "></path>
<path style="stroke:black" d="M372.900000,1071043.500000 L372.900000,1071061.500000 L390.900000,1071061.500000 L390.900000,1071043.500000 "></path>
<path style="stroke:black" d="M372.900000,1071043.500000 L372.900000,1071061.500000 L390.900000,1071061.500000 L390.900000,1071043.500000 "></path>
<path style="stroke:black" d="M390.900000,1071043.500000 L390.900000,1071061.500000 L408.900000,1071061.500000 L408.900000,1071043.500000 "></path>
<path style="stroke:black" d="M390.900000,1071043.500000 L390.900000,1071061.500000 L408.900000,1071061.500000 L408.900000,1071043.500000 "></path>
<path style="stroke:black" d="M408.900000,1071043.500000 L408.900000,1071061.500000 L426.900000,1071061.500000 L426.900000,1071043.500000 "></path>
<path style="stroke:black" d="M408.900000,1071043.500000 L408.900000,1071061.500000 L426.900000,1071061.500000 L426.900000,1071043.500000 "></path>
<path style="stroke:black" d="M426.900000,1071043.500000 L426.900000,1071061.500000 L444.900000,1071061.500000 L444.900000,1071043.500000 "></path>
<path style="stroke:black" d="M426.900000,1071043.500000 L426.900000,1071061.500000 L444.900000,1071061.500000 L444.900000,1071043.500000 "></path>
<path style="stroke:black" d="M444.900000,1071043.500000 L444.900000,1071061.500000 L462.900000,1071061.500000 L462.900000,1071043.500000 "></path>
<path style="stroke:black" d="M444.900000,1071043.500000 L444.900000,1071061.500000 L462.900000,1071061.500000 L462.900000,1071043.500000 "></path>
<path style="stroke:black" d="M324.900000,1071071.220000 L328.680000,1071061.500000 L331.680000,1071071.220000 L324.900000,1071071.220000 "></path>
<path style="stroke:black" d="M342.900000,1071071.220000 L345.900000,1071061.500000 L349.680000,1071071.220000 L342.900000,1071071.220000 "></path>
<path style="stroke:black" d="M360.900000,1071071.220000 L363.900000,1071061.500000 L367.680000,1071071.220000 L360.900000,1071071.220000 "></path>
<path style="stroke:black" d="M378.900000,1071071.220000 L381.900000,1071061.500000 L385.680000,1071071.220000 L378.900000,1071071.220000 "></path>
<path style="stroke:black" d="M396.900000,1071071.220000 L399.900000,1071061.500000 L403.680000,1071071.220000 L396.900000,1071071.220000 "></path>
<path style="stroke:black" d="M414.900000,1071071.220000 L417.900000,1071061.500000 L420.900000,1071071.220000 L414.900000,1071071.220000 "></path>
<path style="stroke:black" d="M432.900000,1071071.220000 L435.900000,1071061.500000 L438.900000,1071071.220000 L432.900000,1071071.220000 "></path>
<path style="stroke:black" d="M450.900000,1071071.220000 L453.900000,1071061.500000 L456.900000,1071071.220000 L450.900000,1071071.220000 "></path>
<path style="stroke:black" d="M247.680000,1071079.500000 L328.680000,1071079.500000 L328.680000,1071070.500000 "></path>
<path style="stroke:black" d="M247.680000,1071097.500000 L345.900000,1071097.500000 L345.900000,1071070.500000 "></path>
<path style="stroke:black" d="M247.680000,1071115.500000 L363.900000,1071115.500000 L363.900000,1071070.500000 "></path>
<path style="stroke:black" d="M247.680000,1071133.500000 L381.900000,1071133.500000 L381.900000,1071070.500000 "></path>
<path style="stroke:black" d="M247.680000,1071151.500000 L399.900000,1071151.500000 L399.900000,1071070.500000 "></path>
<path style="stroke:black" d="M247.680000,1071169.500000 L417.900000,1071169.500000 L417.900000,1071070.500000 "></path>
<path style="stroke:black" d="M247.680000,1071186.720000 L435.900000,1071186.720000 L435.900000,1071070.500000 "></path>
<path style="stroke:black" d="M247.680000,1071204.720000 L453.900000,1071204.720000 L453.900000,1071070.500000 "></path>
<rect y="1071043.5" x="337.68" style="fill:rgba(0,0,0,0);stroke:rgb(0,0,0);stroke-width:1pt;" height="18.0" width="17.22"></rect>
<rect y="1071142.5" x="139.68" style="fill:rgba(0,0,0,0);stroke:rgb(0,0,0);stroke-width:1pt;" height="17.22" width="108.0"></rect>
<text y="1071155.59443" x="157.68" style="font-size:12.001000pt" lengthAdjust="spacingAndGlyphs" textLength="37.2031">ONE  (cid:198)</text>
<text y="1071155.59443" x="219.1803" style="font-size:12.001000pt" lengthAdjust="spacingAndGlyphs" textLength="22.20185">#IE</text>
<rect y="1071070.5" x="139.68" style="fill:rgba(0,0,0,0);stroke:rgb(0,0,0);stroke-width:1pt;" height="18.0" width="108.0"></rect>
<text y="1071083.59443" x="148.68" style="font-size:12.001000pt" lengthAdjust="spacingAndGlyphs" textLength="41.6986746">+ INF (cid:198)</text>
<text y="1071083.59443" x="219.1799" style="font-size:12.001000pt" lengthAdjust="spacingAndGlyphs" textLength="22.20185">#IE</text>
<rect y="1071106.5" x="139.68" style="fill:rgba(0,0,0,0);stroke:rgb(0,0,0);stroke-width:1pt;" height="18.0" width="108.0"></rect>
<text y="1071119.59443" x="148.68" style="font-size:12.001000pt" lengthAdjust="spacingAndGlyphs" textLength="41.6986746">- INF (cid:198)</text>
<text y="1071119.59443" x="219.1799" style="font-size:12.001000pt" lengthAdjust="spacingAndGlyphs" textLength="22.20185">#IE</text>
<rect y="1071124.5" x="139.68" style="fill:rgba(0,0,0,0);stroke:rgb(0,0,0);stroke-width:1pt;" height="18.0" width="108.0"></rect>
<text y="1071137.59443" x="153.96" style="font-size:12.001000pt" lengthAdjust="spacingAndGlyphs" textLength="37.2031">SNaN (cid:198)</text>
<text y="1071137.59443" x="219.1806" style="font-size:12.001000pt" lengthAdjust="spacingAndGlyphs" textLength="22.20185">#IE</text>
<rect y="1071088.5" x="139.68" style="fill:rgba(0,0,0,0);stroke:rgb(0,0,0);stroke-width:1pt;" height="18.0" width="108.0"></rect>
<text y="1071101.59443" x="148.68" style="font-size:12.001000pt" lengthAdjust="spacingAndGlyphs" textLength="7.2006">-</text>
<text y="1071101.59443" x="164.4601149" style="font-size:12.001000pt" lengthAdjust="spacingAndGlyphs" textLength="29.6988747">VE  (cid:198)</text>
<text y="1071101.59443" x="219.1799" style="font-size:12.001000pt" lengthAdjust="spacingAndGlyphs" textLength="22.20185">#IE</text>
<rect y="1071159.72" x="139.68" style="fill:rgba(0,0,0,0);stroke:rgb(0,0,0);stroke-width:1pt;" height="18.0" width="108.0"></rect>
<text y="1071172.81443" x="157.68" style="font-size:12.001000pt" lengthAdjust="spacingAndGlyphs" textLength="37.2031">ONE  (cid:198)</text>
<text y="1071172.81443" x="219.1803" style="font-size:12.001000pt" lengthAdjust="spacingAndGlyphs" textLength="22.20185">#ZE</text>
<rect y="1071177.72" x="139.68" style="fill:rgba(0,0,0,0);stroke:rgb(0,0,0);stroke-width:1pt;" height="18.0" width="108.0"></rect>
<text y="1071190.81443" x="153.96" style="font-size:12.001000pt" lengthAdjust="spacingAndGlyphs" textLength="37.2031">ZERO (cid:198)</text>
<text y="1071190.81443" x="219.1806" style="font-size:12.001000pt" lengthAdjust="spacingAndGlyphs" textLength="22.20185">#IE</text>
<rect y="1071195.72" x="139.68" style="fill:rgba(0,0,0,0);stroke:rgb(0,0,0);stroke-width:1pt;" height="18.0" width="108.0"></rect>
<text y="1071208.81443" x="153.96" style="font-size:12.001000pt" lengthAdjust="spacingAndGlyphs" textLength="37.2031">ZERO (cid:198)</text>
<text y="1071208.81443" x="219.1806" style="font-size:12.001000pt" lengthAdjust="spacingAndGlyphs" textLength="22.20185">#ZE</text></svg>
<h3>Figure 5-11.  VFIXUPIMMSD Immediate Control Description</h3>
<p><strong>Intel C/C++ Compiler Intrinsic Equivalent</strong></p>
<p>VFIXUPIMMSD __m128d _mm_fixupimm_sd( __m128d a, __m128i tbl, int imm);</p>
<p>VFIXUPIMMSD __m128d _mm_mask_fixupimm_sd(__m128d s, __mmask8 k, __m128d a, __m128i tbl, int imm);</p>
<p>VFIXUPIMMSD __m128d _mm_maskz_fixupimm_sd( __mmask8 k, __m128d a, __m128i tbl, int imm);</p>
<p>VFIXUPIMMSD __m128d _mm_fixupimm_round_sd( __m128d a, __m128i tbl, int imm, int sae);</p>
<p>VFIXUPIMMSD __m128d _mm_mask_fixupimm_round_sd(__m128d s, __mmask8 k, __m128d a, __m128i tbl, int imm, int sae);</p>
<p>VFIXUPIMMSD __m128d _mm_maskz_fixupimm_round_sd( __mmask8 k, __m128d a, __m128i tbl, int imm, int sae);</p>
<p><strong>SIMD Floating-Point Exceptions</strong></p>
<p>Zero, Invalid</p>
<p><strong>Other Exceptions</strong></p>
<p>See Exceptions Type E3.</p></body></html>